from django.db import models
from baseModels import BaseModel


class Nav(BaseModel):
    is_show = models.BooleanField(default=True, verbose_name="始发显示")
    link = models.CharField(default="", max_length=200, verbose_name="外部链接")
    is_http = models.BooleanField(default=False, verbose_name="是否是外部链接")

    position_choices = (
        (0, "顶部导航"),
        (1, "脚部导航"),
    )
    position = models.IntegerField(choices=position_choices, default=0, verbose_name="导航位置")

    class Meta:
        db_table = "fg_nav"  # 数据表名称
        verbose_name = "导航菜单"  # 在 Django 管理界面中显示为 "导航菜单"
        verbose_name_plural = verbose_name  # 模型的复数名称，这里设置为与单数名称相同


class Banner(BaseModel):
    image = models.ImageField(upload_to='banner/%Y/', verbose_name="图片地址")
    link = models.CharField(max_length=200, verbose_name="链接地址")
    note = models.CharField(max_length=150, verbose_name="备注信息")
    is_http = models.BooleanField(default=False, verbose_name="是否是外链地址")
    is_show = models.BooleanField(default=True, verbose_name="始发显示")

    class Meta:
        db_table = "fg_banner"
        verbose_name = "轮播广告"
        verbose_name_plural = verbose_name
